﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;


namespace KentekenHerkenning
{
    /// <summary>
    /// Made by Marleen Schilt
    /// Draws a rectangle on the given area
    /// </summary>
    public class DrawRectangles
    {

        /// <summary>
        /// Draws an rectangle at the from the start pixelpoint to the end pixelpoint
        /// </summary>
        /// <param name="sourceImage">the sourceimage</param>
        /// <param name="Start">the start pixelpoint</param>
        /// <param name="End">the end pixelpoint</param>
        /// <returns>the edited bitmap</returns>
        public static  Bitmap drawRectangle(Bitmap sourceImage, PixelPoint Start, PixelPoint End)
        {
            int numberplateWidth = 0;
            int numberplateHeight = 0;

            Bitmap rectangleDrawingImage = sourceImage;

            Graphics GraphicsObject = Graphics.FromImage(rectangleDrawingImage);

            numberplateWidth = End.xPos - Start.xPos;
            numberplateHeight = End.yPos - Start.yPos;

            GraphicsObject.DrawRectangle(Pens.Red, Start.xPos, Start.yPos, numberplateWidth, numberplateHeight);

            return rectangleDrawingImage;
            
        }
    }
}
